﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;


namespace PersistentObject.Common.DataConvertors
{
    /// <summary>
    /// Represent a data convertor
    /// </summary>
    public abstract class DataConvertor
    {
        /// <summary>
        /// Initialize a data convertor
        /// </summary>
        public DataConvertor()
        {
        }

        public abstract DbType GetDbType();

        /// <summary>
        /// Convert an object value to a database value
        /// </summary>
        /// <param name="ClrObject">Indicate the object value</param>
        /// <returns>Return a database value</returns>
        public abstract object PersistFrom(object ClrObject);

        /// <summary>
        /// Retrieve a database value to an object value
        /// </summary>
        /// <param name="PersistentObject">Indicate the database value</param>
        /// <returns>Return an object value</returns>
        public abstract object RetrieveFrom(object PersistentObject);
    }
}
